﻿using MyUAMS.DAL;
using System;
using System.Collections.Generic;
using System.Data.SqlTypes;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace MyUAMS.BLL
{
    public class MaintenanceServer
    {
        DataClasses1DataContext db=new DataClasses1DataContext();
        public List<User_Table> GetAllMan()
        {
            return (from c in db.User_Table
                    where c.Fid == 4
                    select c).ToList();
        }
        public Asset_Table GetAssetByAid(int id)
        {
            return(from c in db.Asset_Table 
                   where c.Aid == id 
                   select c).First();
        }
        public void insertMaintenance(int aid,string aname,string mfname,decimal fphone,string mtname,decimal tphone,DateTime date,string describe,string area,string rdate)
        {
            Maintenance_Table mtabel = new Maintenance_Table();
            mtabel.Aid = aid;
            mtabel.Aname = aname;
            mtabel.MFname = mfname;
            mtabel.Ftelephone = fphone;
            mtabel.MTname = mtname;
            mtabel.Ttelephone = tphone;
            mtabel.Date = date;
            mtabel.Describe = describe;
            mtabel.area = area;
            mtabel.RDate = rdate;
            db.Maintenance_Table.InsertOnSubmit(mtabel);
            db.SubmitChanges();
        }
        public User_Table GetUnameByUid(int uid)
        {
            return (from c in db.User_Table
                    where c.Uid == uid
                    select c).First();
        }
    }
}
